function QuizView(param) {
	var self = Ti.UI.createWindow({
		title : param.detailTitle,
		//title:_args.title,
		backgroundColor:'#fff'
	});

var knowledgeArea = param.knowledge;
	knowledgeArea = knowledgeArea.replace(/\s+/g,"");
	knowledgeArea[0] = knowledgeArea[0].toLowerCase();
		
	/**
	 * 
	 * multidimensional array containing questions, choices, and answers for a knowledge area
	 * 
	 * 
	 */
	var toolsObject = {

		"PlanScheduleManagement" : {

			"question1" : {

				"question" : 'Schedule Management Plan is the output for the Plan Schedule Management Process.  It is a major input in _______, a process in the Project Integration Management Knowledge Area',

				"choices" : 'a. Plan Scope\nb. Develop Project Charter\nc. Develop Project Management Plan\nd. Define Activities',

				"answer" : 'c'

			},

			"question2" : {

				"question" : 'Plan Schedule inputs include________',

				"choices" : 'a. Project Management Plan\nb. a and d\nc. Lead and lags \nd. Project Charter',

				"answer" : 'b'

			}

		},

		"DefineActivities" : {

			"question1" : {

				"question" : 'Outputs for Define Activities Process include?',

				"choices" : 'a. Schedule Mangement Plan\nb. Enterprise Organization Structure\nc. Milestone List\nd. Project Charter',

				"answer" : 'c'

			},

			"question2" : {

				"question" : 'This process identifies and documents the specific actions to be performed to produce the project deliverables',

				"choices" : 'a. Scope Baseline\nb. Define Activities\nc. Develop Project Management Plan\nd. Sequence Activities',

				"answer" : 'b'

			}

		},

		"SequenceActivities" : {

			"question1" : {

				"question" : 'Tools and Techniques for Sequence Actitities roesclude?',

				"choices" : 'a. Organizational Process Assets\nb. Project Schedule Diagram\nc. Precedence Diagraming Method \nd. Milestone List',

				"answer" : 'c'

			},

			"question2" : {

				"question" : 'Outputs of Sequence Activities include',

				"choices" : 'a. Dependencies Determinnation\nb. c and d\nc. Project Schedule Network Diagram\nd. Project Document Updates',

				"answer" : 'b'

			}

		},

		"EstimateActivityResources" : {

			"question1" : {

				"question" : 'Risk Register is an input of this process',

				"choices" : 'a. Sequence Activity\nb. Define Activity\nc. Estimate Activity Resources\nd. Develop Schedule',

				"answer" : 'c'

			},

			"question2" : {

				"question" : 'Activity Resource Requirements',

				"choices" : 'a. are documents such as activity lists, activity attributes and resource calendar\nb. identifies the types and resources required for each activity in a work package\nc. is opinion provided by a group or person with experience in activity resource \nd. is used for constructing schedule model in which activities are represented by nodes and are graphically linked by one or more logical relationships to show the sequence in which the activities are to be performed',

				"answer" : 'b'

			}

		},

			"EstimateActivityDuration" : {

			"question1" :	{

			"question" : ' uses algorithm to calculate cost or duration based on historical data and project parameters.  It uses statistical relationship between historical data and other variables to calculate and estimate for activity parameters such as cost, budget, and duration.',

			"choices" : 'a. Reserve Analysis\nb. Analogous Estimating\nc. Parametric Estimating\nd. b and c',

			"answer" : 'c'

			},

			"question2" :	{

			"question" : 'This output quantitative assessments of the likely number of time periods that are required to complete an activity',

			"choices" : 'a. Work Performance Data\nb. Activity Duration Estimate\nc. Activity Resource Requirement \nd. Project Schedule',

			"answer" : 'b'

			}

			}

			,

			"DevelopSchedule" : {

			
			"question1" :	{
			
			"question" : '________ allows project team to place buffers on any schedule path to account for limited resources and project uncertainties.',
			
			"choices" : 'a. Modeling Technique\nb. Enterprise Organization Structure\nc. Critical Chain Method\nd. Critical Path Method',
			
			"answer" : 'c'
			
			},


			"question2" :	{

			"question" : 'This process involves analyzing activity sequences, durations, resource requirements, and schedule constraints to create the project schedule model.  This allows for generating of a schedule model with planned dates for completing project activities.',

			"choices" : 'a. Define Activities\nb. Develop Schedule\nc. Develop Project Management Plan\nd. Control Schedule',

			"answer" : 'b'

			}

			},

			"ControlSchedule" : {

			"question1" :	{

			"question" : 'This is an input to Control Schedule',

			"choices" : 'a. Schedule Data\nb. Work Performance Data\nc. A and b \nd. Schedule Data',

			"answer" : 'c'

			},

			"question2" :	{

			"question" : '________ refers to information about project progress such as activities that have started their progress and activities that have been finished ',

			"choices" : 'a. Schedule Data\nb. Work Performance Data\nc. Project Schedule\nd. Project Document Updates',

			"answer" : 'b'

			}

			}


	}; 

/*
 * 
 * 
 * create empty scrollable view for each question
 */
	var scrollView = Titanium.UI.createScrollableView({
		
	
		views:[],
		showPagingControl:true,
		pagingControlHeight:30,
		maxZoomScale:2.0,
		currentPage:0
	});
	

	var views_= {};
	var labels = {};

/*
 * create 2 view with labels to add to the scrollable view
 * each view contains 1 question, 1 choices object, 1 answer, 1 button to show/hide answer
 * 
 * 
 */	
	views_['view1'] = Ti.UI.createView({
		backgroundColor:'black'
	});
	labels['q1'] = Ti.UI.createLabel({
		text:toolsObject[knowledgeArea]['question1'].question,
		color:'#fff',
		top:10,
		width:'auto',
		height:'auto'
		
	});
	views_['view1'].add(labels['q1']);
	
	labels['c1'] = Ti.UI.createLabel({
		text:toolsObject[knowledgeArea]['question1'].choices,
		color:'#fff',
		top:150,
		width:'auto',
		height:'auto'
	});
	views_['view1'].add(labels['c1']);
	
	
	var tr1 = Ti.UI.create2DMatrix();
	tr1 = tr1.rotate(180);
	//Hide Show Button
	
	var toggleAnswer1 = Titanium.UI.createButton({
		title:'Show Answer Below',
		width:200,
		height:40,
		bottom:20
	});
	var visible1 = false;
	toggleAnswer1.addEventListener('click', function()
	{
		if (!visible1)
		{
			labels['a1'].show();
			visible1=true;
			toggleAnswer1.title = 'Hide Answer Below';

		}
		else
		{
			labels['a1'].hide();
			visible1=false;
			toggleAnswer1.title = 'Show Answer Below';

		}
	});
	
	
	views_['view1'].add(toggleAnswer1);
	//end hide show
	labels['a1'] = Ti.UI.createLabel({
		text:toolsObject[knowledgeArea]['question1'].answer,
		color:'#fff',
		bottom:10,
		width:'auto',
		height:'auto',
		visible: false,
		color:'green',
		transform: tr1
	});
	views_['view1'].add(labels['a1']);
	
	//Question 2
	views_['view2'] = Ti.UI.createView({
		backgroundColor:'black'
	});
	labels['q2'] = Ti.UI.createLabel({
		text:toolsObject[knowledgeArea]['question2'].question,
		color:'#fff',
		top:10,
		width:'auto',
		height:'auto'
		
	});
	views_['view2'].add(labels['q2']);
	
	labels['c2'] = Ti.UI.createLabel({
		text:toolsObject[knowledgeArea]['question2'].choices,
		color:'#fff',
		top:150,
		width:'auto',
		height:'auto'
	});
	views_['view2'].add(labels['c2']);
	
	
	var tr2 = Ti.UI.create2DMatrix();
	tr2 = tr2.rotate(180);
	
		//Hide Show Button
	
	var toggleAnswer2 = Titanium.UI.createButton({
		title:'Show Answer Below',
		width:200,
		height:40,
		bottom:20
	});
	
	var visible2 = false;
	toggleAnswer2.addEventListener('click', function()
	{
		if (!visible2)
		{
			labels['a2'].show();
			visible2=true;
			toggleAnswer2.title = 'Hide Answer Below';
		}
		else
		{
			labels['a2'].hide();
			visible2=false;
			toggleAnswer2.title = 'Show Answer Below';

		}
	});
	
	var visible2 = false;
	views_['view2'].add(toggleAnswer2);
	//end hide show
	
	labels['a2'] = Ti.UI.createLabel({
		text:toolsObject[knowledgeArea]['question2'].answer,
		color:'#fff',
		bottom:10,
		width:'auto',
		height:'auto',
		visible: false,
		color:'green',
		transform: tr2
	});
	views_['view2'].add(labels['a2']);
	
	//End Question 2
	
	scrollView.addView(views_['view1']);
	scrollView.addView(views_['view2']);
	//}

	// add table view to the window
	self.add(scrollView);
	return self;
};

module.exports = QuizView;
